from django.template.library import Library
from markdown2 import markdown
from django.utils.safestring import mark_safe

register = Library()


@register.filter("md")
def render_md(text: str):
    return mark_safe(markdown(text, extras=["header-ids"]))
